<?php
require_once ('../../config/include_paths.php');
require_once('config.php');
require_once('dbconnect.php');	// database connect script.
$action 				= $_POST['action'];
$updateRecordsArray 	= $_POST['recordsArray'];
$table					= $_POST['table'];

if ($action == "updateRecordsListings"){

	$listingCounter = 1;
	foreach ($updateRecordsArray as $module_idValue) {

		$query = "UPDATE $table SET record_order = " . $listingCounter . " WHERE id = " . $module_idValue;
		mysql_query($query) or die('Error, insert query failed');
		$listingCounter = $listingCounter + 1;
	}

	echo '<pre>';
	print_r($updateRecordsArray);
	echo '</pre>';
	echo 'If you refresh the page, you will see that records will stay just as you modified.';
}
if ($action == "updateEnabled"){
	$enabledValue = $_POST['enabledVar'];
	$module_idValue = $_POST['module_idVar'];
		$query = "UPDATE $table SET enabled = " . $enabledValue . " WHERE id = " . $module_idValue;
		mysql_query($query) or die('Error, insert query failed');
	echo '<pre>';
	print_r($query);
	echo '</pre>';
}
		
	
?>